home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
math
/
newmat08
/
sl_ex.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-18
|
615b
|
29 lines
// This is an example of the use of solution to find the cube root of
// the integers -10 to 10
// you will need to compile and link solution.cpp and except.cpp
#define WANT_STREAM
#define WANT_MATH
#include "include.h"
#include "solution.h"
// the cube class
class Cube : public R1_R1
{ Real operator()() { return x*x*x; } };
main()
{
// construct the Cube object
Cube cube;
// and then the solve object
OneDimSolve cube_root(cube);
// Now do the solves
for (int i=-10; i<=10; i++)
cout << i << " " << cube_root.Solve(i,0,1.5) << endl;
return 0;
}